var layer = layui.layer;
layui.config({
    base: '/lib/winui/' //指定 winui 路径
    , version: '1.0.0-beta'
}).define(['table', 'jquery', 'winui'], function (exports) {
    winui.renderColor();
    $('#add').on('click', function () {
        var layer = layui.layer;

        top.winui.window.open({
            id: 'add',
            type: 2,
            end: function () {
                window.location.reload();
            },
            title: '添加区域',
            content: '/newmerchantservice/sysAreaController/toAdd',
            area: ['60vw', '70vh'],
            offset: ['15vh', '20vw'],
        });
    });
    $('#reloadTable').on('click', function () {
        window.location.reload();
    });

});

function deleteArea(id) {
    layer.confirm('删除后不可恢复，是否确认删除？', function (index) {
        // obj.del();
        layer.close(index);
        $ = layui.jquery;
        $.get('/newmerchantservice/sysAreaController/delete?id=' + id, function () {
            window.location.reload();
        });

    });
}

function addArea(id) {
    // layer.open({
    //     type: 2,            end: function () {                layer.close(index)                top.winui.window.close('addDict');                window.location.reload();            },
    //     title: '添加',
    //     shadeClose: true,
    //     shade: 0.8,
    //     area: ['580px', '90%'],
    //     content: '/menu/toAdd?  + "&id=" + id //iframe的url
    // });

    top.winui.window.open({
        id: 'add',
        type: 2,
         end: function () {
             window.location.reload();
         },
        title: '添加区域',
        content: '/newmerchantservice/sysAreaController/toAdd?id=' + id,
        area: ['60vw', '70vh'],
        offset: ['15vh', '20vw'],
    });
}

function toUpdate(id) {
    // layer.open({
    //     type: 2,            end: function () {                layer.close(index)                top.winui.window.close('addDict');                window.location.reload();            },
    //     title: '修改',
    //     shadeClose: true,
    //     shade: 0.8,
    //     area: ['580px', '90%'],
    //     content: '/menu/toUpdate?  + "&id=" + id //iframe的url
    // });


    top.winui.window.open({
        id: 'edit',
        type: 2,
         end: function () {
             window.location.reload();
         },
        title: '修改区域',
        content: '/newmerchantservice/sysAreaController/toUpdate?id=' + id,
        area: ['60vw', '70vh'],
        offset: ['15vh', '20vw'],
    })
}

